/*
 * by F 
 * date 2015-07-02
 * version 1.0.0
 */
/*userAgent*/
var browser = function(){
	var u = navigator.userAgent.toLowerCase(), app = navigator.appVersion;
	return {//移动终端浏览器版本信息
		mobile : (function(){
			if( u.indexOf('mobile') > -1 ){//是否为移动终端
				return {
					ie : u.indexOf('trident') > -1, //IE内核
					opera : u.indexOf('presto') > -1, //opera内核
					webkit : u.indexOf('applewebkit') > -1, //苹果、谷歌内核
					chrome:u.indexOf('chrome') > -1,
					firefox : u.indexOf('gecko') > -1 && u.indexOf('khtml') == -1, //火狐内核
					ios : !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端                 
					android : u.indexOf('android') > -1 || u.indexOf('linux') > -1, //android终端或者uc浏览器                                 
					iphone : u.indexOf('iphone') > -1 || u.indexOf('mac') > -1, //是否为iPhone或者QQHD浏览器                    
					webapp : u.indexOf('safari') == -1//是否web应该程序，没有头部与底部
				};
			}else{
				return false;
			};
		})(),
		ipad : (function(){  return ( u.indexOf('iphone') > -1 && u.indexOf('ipad') > -1 )  })(),
		pc : (function(){
			if( u.indexOf('mobile') > -1 || u.indexOf('Mobile') > -1 ){//是否为移动终端
				return false;
			}else{
				return {
					ie :(function(){
						if(/msie/i.test(u)){return u.match(/msie (\d+)/i)[1];}else if(~u.toLowerCase().indexOf('trident') && ~u.indexOf('rv')){return u.match(/rv:(\d+)/)[1];}return false;
					}()),	
					opera:u.indexOf('opera') > -1,
					firefox:u.indexOf('firefox') > -1,
					safari:u.indexOf('safari') > -1 && u.indexOf('chrome') == -1,
					chrome:u.indexOf('chrome') > -1
				};
			};
		})(),
		canvas : (function(){return document.createElement('canvas').getContext;})(),
		css3 : (function(style){
			style = style || 'transform';
			var prefix = ['webkit', 'Moz', 'ms', 'o'],i,humpString = [],htmlStyle = document.documentElement.style,  
			_toHumb = function (string) {return string.replace(/-(\w)/g, function ($0, $1){return $1.toUpperCase();});};  
			for (i in prefix)
			humpString.push(_toHumb(prefix[i] + '-' + style));  
			humpString.push(_toHumb(style));  
			for (i in humpString)  
			if (humpString[i] in htmlStyle) return true;  
			return false;
		})(),
		transition : (function(){
			var s = document.createElement('p').style,
				r = 'transition' in s ||
					  'WebkitTransition' in s ||
					  'MozTransition' in s ||
					  'msTransition' in s ||
					  'OTransition' in s;
			s = null;
			return r;
		})()
	};
}();//browser end
var uVersions='';
if(browser.pc.ie){
	uVersions = 'ie' + (browser.pc.ie > 8 ? browser.pc.ie+ 'css3' : browser.pc.ie);
}else if(browser.pc.opera){
	uVersions = 'opera css3';
}else if(browser.pc.firefox){
	uVersions = 'firefox css3';
}else if(browser.pc.safari){
	uVersions = 'safari css3';
}else if(browser.pc.chrome){
	uVersions = 'chrome css3';
}else if(browser.mobile.iphone){
	uVersions = 'iphone css3';
}else if(browser.mobile.android){
	uVersions = 'android css3';
}else{
	uVersions = 'other';
};
//window.onload = function(){document.getElementsByTagName('body')[0].className += ' '+uVersions;};
document.getElementsByTagName('html')[0].className += ' '+uVersions;
/*userAgent END*/